import request from '@/utils/request'

// 添加
export function addCommodityOrders(data) {
  return request({
    url: '/commodityOrders/add',
    method: 'post',
    data: data
  })
}

// 编辑
export function editCommodityOrders(data) {
  return request({
    url: '/commodityOrders/edit',
    method: 'post',
    data: data
  })
}

// ID查询单个数据
export function getCommodityOrders(id) {
  return request({
    url: '/commodityOrders/info',
    method: 'post',
    params: { id }
  })
}

// 删除
export function delCommodityOrders(id) {
  return request({
    url: '/commodityOrders/delete',
    method: 'post',
    params: { id }
  })
}

// 批量删除
export function delListCommodityOrders(idList) {
  return request({
    url: '/commodityOrders/delete/list',
    method: 'post',
    data: idList
  })
}

// 查询分页数据
export function dataCommodityOrders(query) {
  return request({
    url: '/commodityOrders/data',
    method: 'post',
    params: query
  })
}

// 查询全部数据
export function allCommodityOrders() {
  return request({
    url: '/commodityOrders/all',
    method: 'post',
  })
}

// 条件查询列表数据
export function listCommodityOrders(data) {
  return request({
    url: '/commodityOrders/list',
    method: 'post',
    data: data
  })
}

// 根据字段、排序方式、limit条 查询列表数据
export function listLimitCommodityOrders(field, sort, limit) {
  return request({
    url: '/commodityOrders/list/limit',
    method: 'post',
    params: { field, sort, limit }
  })
}

// 根据字段查询列表数据
export function listFieldCommodityOrders(field, value) {
  return request({
    url: '/commodityOrders/list/field',
    method: 'post',
    params: { field, value }
  })
}

// 动态查询单个数据
export function dynamicGetCommodityOrders(data) {
  return request({
    url: '/commodityOrders/info/dynamic',
    method: 'post',
    data: data
  })
}

// 查看详情数据
export function detailsGetCommodityOrders(id) {
  return request({
    url: '/commodityOrders/details',
    method: 'post',
    params: { id }
  })
}

// 全部条数
export function countCommodityOrders() {
  return request({
    url: '/commodityOrders/count',
    method: 'post',
  })
}

// 条件查询条数
export function dynamicCountCommodityOrders(data) {
  return request({
    url: '/commodityOrders/count/dynamic',
    method: 'post',
    data: data
  })
}

// 直接下单
export function addCommodityOrders2(data) {
  return request({
    url: '/commodityOrders/add2',
    method: 'post',
    data: data
  })
}

export function statisticsCommodityOrdersYear() {
  return request({
    url: '/commodityOrders/statistics/year',
    method: 'post',
  })
}
